package com.likejian.rabbit.simple;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.likejian.rabbit.RabbitConfig;

@Component
public class SimpleSender {

	@Autowired
	private AmqpTemplate rabbitTemplate;
	
	public void send(String message){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
		String context = message + "_" + sdf.format(new Date());
		System.out.println("SimpleSender1=" + context);
		this.rabbitTemplate.convertAndSend(RabbitConfig.SPRINGBOOT_RABBIT_SIMPLE_QUEUE, context);
	}
}
